﻿
@{
    ViewBag.Title = "用户登录";
    Layout = "~/Views/Shared/_Layout_BBS.cshtml";
    var qqUrl = UI.GetQQUrl();
    var wbUrl = UI.GetWbUrl();
}
@section js{
    <script type="text/javascript">
        layui.define(['ejq', 'ajaxforms', 'layer'], function (exports) {

            /***变量***/
            var $ = layui.ajaxforms;
            var layer = layui.layer;
            var $userName = $("#UserName");
            var $password = $("#Password");
            var $vercode = $("#Vercode");
            var $btnLogin = $("#btnLogin");
            var $hidReturnUrl = $("#hidReturnUrl");
            var $imgOutPutVerifyCode = $("#imgOutPutVerifyCode");
            /***事件***/
            $imgOutPutVerifyCode.click(function () {
                var th = $(this);
                var src = th.attr("src") + "1";
                th.attr("src", src);
            });
            $btnLogin.click(function (e) {
                e.preventDefault();
                if ($userName.val() == "") {
                    layer.msg('邮箱不能为空！')
                } else if ($password.val() == "") {
                    layer.msg('密码不能为空！')
                } else if ($vercode.val() == "") {
                    layer.msg('验证码不能为空！')
                } else {
                    debugger
                    var url = $.action.url("LoginSubmit", null, "Home", null);
                    $("form").ajaxSubmit({
                        type: 'post',
                        url: url,
                        success: function (msg) {
                            if (msg.IsSuccess) {
                                window.location.href = msg.ResultInfo;
                            } else {
                                layer.msg(msg.ResultInfo, {
                                    icon: 2
                                });
                            }
                        }, error: function (msg) {

                        }
                    })
                }
            });

          
        });
    </script>
}
@using Infrastructure.DbModel
@using OAuth.Tools
@using SyntacticSugar
<div class="main layui-clear">
    <h2 class="page-title">登入</h2>
    <div class="layui-form layui-form-pane">
        <form method="post">
            <input id="hidReturnUrl" name="returnUrl" type="hidden" value="@ViewBag.ReturnUrl" />
            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">邮箱</label>
                <div class="layui-input-inline">
                    <input type="text" id="UserName" name="UserName"   lay-verify="required" autocomplete="off" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                    <input type="password" id="Password" name="Password"   lay-verify="required" autocomplete="off" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_vercode" class="layui-form-label">人类验证</label>
                <div class="layui-input-inline">
                    <input type="text" id="Vercode" name="vercode"   lay-verify="required" placeholder="请回答后面的问题" autocomplete="off" class="layui-input" />
                </div>
                <div class="layui-form-mid">
                    <span style="color: #c00;"><img id="imgOutPutVerifyCode" src="@Url.Action("OutPutVerifyCode","Home",new { Area=""})?r=" /></span>
                </div>
            </div>
            <div class="layui-form-item">
                <button id="btnLogin" class="layui-btn" lay-filter="*" lay-submit="">立即登录</button>
                <span style="padding-left:20px;"> <a href="/user/forget">忘记密码？</a> </span>
            </div>
            <div class="layui-form-item fly-form-app">
                <span>或者使用社交账号登入</span>
                <a href="@qqUrl" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-qq" title="QQ登入"></a>
                <a href="@wbUrl" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-weibo" title="微博登入"></a>
            </div>
        </form>
    </div>
</div>
